package com.af.security.property;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @author : zhenyun.su
 * @since : 2020/09/30
 * @common: Ldap配置

 */

@Configuration
@ConfigurationProperties(prefix="asu.ldap")
public class LdapProperties {
    private static final Logger logger = LoggerFactory.getLogger(LdapProperties.class);
    private Boolean enabled;
    private String url;
    private String managerDn;
    private String managerPassword;
    private String userSearchFilter;

    @PostConstruct
    public void print(){
        logger.debug("load sys config from application.yaml, {}", this);
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getManagerDn() {
        return managerDn;
    }

    public void setManagerDn(String managerDn) {
        this.managerDn = managerDn;
    }

    public String getManagerPassword() {
        return managerPassword;
    }

    public void setManagerPassword(String managerPassword) {
        this.managerPassword = managerPassword;
    }

    public String getUserSearchFilter() {
        return userSearchFilter;
    }

    public void setUserSearchFilter(String userSearchFilter) {
        this.userSearchFilter = userSearchFilter;
    }

    @Override
    public String toString() {
        return "LdapProperties{" +
                "enabled=" + enabled +
                ", url='" + url + '\'' +
                ", managerDn='" + managerDn + '\'' +
                ", managerPassword='" + managerPassword + '\'' +
                ", userSearchFilter='" + userSearchFilter + '\'' +
                '}';
    }
}
